//
//  AllMenuView.m
//  EarnBao
//
//  Created by iMac on 15/10/8.
//  Copyright (c) 2015年 杭州赚宝科技有限公司. All rights reserved.
//

#import "AllMenuView.h"
#define Button_Width 40.0
#define Button_Height 20.0

@implementation AllMenuView
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubviews];
    }
    return self;
}
-(void)addSubviews
{
    [self setBackgroundColor:[UIColor colorWithRed:251/255.f green:252/255.f blue:254/255.f alpha:0.95]];
}
-(void)initWithArray:(NSArray *)array
{
    int num=kMainScreen_Width*0.94/Button_Width;
    for (int i=0; i<array.count; i++) {
        int colum=i/num;//行
        int row=i%num;//列
        UIButton *button=[[UIButton alloc]init];
        [button setFrame:CGRectMake(kMainScreen_Width*0.03+Button_Width*row, Button_Height*colum+10*colum, Button_Width, Button_Height)];
        [button setTitle:array[i] forState:UIControlStateNormal];
        [button.titleLabel setFont:FONT_DEFAULT15];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self addSubview:button];
    }
    
    
    UIButton *buttonMore=[[UIButton alloc]init];
    [buttonMore setFrame:CGRectMake(kMainScreen_Width*0.4, self.frame.size.height-30, kMainScreen_Width*0.2, Button_Height)];
    [buttonMore setTitle:@"更多分类" forState:UIControlStateNormal];
    [buttonMore.titleLabel setFont:FONT_DEFAULT15];
    [buttonMore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self addSubview:buttonMore];
}
@end











